//递归获取列表
export  function getPermissionListArr(Arr){
  let result=[]
  const idMapping=Arr.reduce((acc,el,i)=>{
      if(acc.parent_id!==0){
          // acc[el.permission_id] = i ;
          if(el.permission_id){
              acc[el.permission_id] = i ;
          }else {
              acc[el.good_type_id] = i ;
          }
          return acc;
      }
  },{})
 Arr.forEach(item=>{
     if(item.parent_id===0){
         result.push(item)
         return;
     }
     const parentEl = Arr[idMapping[item.parent_id]];
    if(parentEl){
        // 把当前元素添加到父元素的`children`数组中
        parentEl['children'] = [...(parentEl['children'] || []), item];
    }

 })
  return result
}